<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="../application/vue.js"></script>
</head>
<body>
    <div class="app">
        <p>msg:{{msg}}</p>
        <p v-text="msg"></p>
        <input type="text" v-model="msg">
        <p v-yun="'red'">自定义指令</p>
        <p v-yun="'yellow'">自定义指令</p>
        <p v-yun="'purple'">自定义指令</p>
        <p v-yun="'blue'">自定义指令</p>
        <p v-yun="'green'">自定义指令</p>
        <p v-yun:b.c="msg+'aaa'">自定义指令</p>
    </div>
</body>
<script>
    //全局指令定义
    Vue.directive("yun",function(el,binding){
        console.log("自定义指令",el,binding);
        el.style.color=binding.value;
    })
    var vm=new Vue({
        el:".app",
        data:{
            msg:"王梦云"
        }
    })
</script>
</html>